/*
package com.ruiyi.subway.web;

import com.yuancore.vcs.common.dto.RestResponse;
import com.yuancore.vcs.common.exception.VcsRestException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@ControllerAdvice
public class GlobalRestExceptionHandler {
	private static final Log log = LogFactory.getLog(GlobalRestExceptionHandler.class);
	
	@ExceptionHandler(VcsRestException.class)
	public @ResponseBody RestResponse<String> handleRestException(HttpServletRequest req, HttpServletResponse resp, VcsRestException ex) throws Exception{
		log.error(getLogMessage(req, ex), ex);
		resp.setContentType("application/json;charset=UTF-8");
		return RestResponse.failed(ex.getMessage());
	}

	private String getLogMessage(HttpServletRequest req, VcsRestException ex) {
		return String.format("%s %s failed, detail: %s" , req.getMethod(), req.getPathInfo(), ex.getMessage());
	}

}
*/
